﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DevExpress.XtraEditors;

namespace DatabaseManager.WinForms.Common
{
    public class DevExpressHelper
    {
        /// <summary>
        /// 设置进度条颜色
        /// </summary>
        /// <param name="progressBar"></param>
        /// <param name="startColor">起始颜色</param>
        /// <param name="endColor">结束颜色，跟起始颜色形成渐变色效果，如果不设置则用起始颜色</param>
        public static void SetProgressBarColor(ProgressBarControl progressBar, Color startColor, Color? endColor = null)
        {
            progressBar.Properties.ProgressViewStyle = DevExpress.XtraEditors.Controls.ProgressViewStyle.Solid;
            if (endColor == null)
                progressBar.Properties.EndColor = startColor;
            else
                progressBar.Properties.EndColor = endColor.Value;
            progressBar.Properties.StartColor = startColor;
            progressBar.Properties.ShowTitle = true;
            progressBar.Properties.LookAndFeel.SetStyle(DevExpress.LookAndFeel.LookAndFeelStyle.UltraFlat, false, false);
        }

    }
}
